package cn.edu.fzu.delivery.common;

public final class Result {

    public static Result SUCCESS = new Result(null);

    // 返回码
    private final int     code;
    // 返回结果
    private final Object  value;
    // 错误消息
    private final String  message;

    /**
     * 默认返回值为 200(成功)
     * 
     * @param value
     */
    public Result(Object value) {
        this.code = RetCode.SUCCESS;
        this.value = value;
        this.message = null;
    }


    public Result(int code, String message) {
        this.code = code;
        this.message = message;
        this.value = null;
    }


    public Result(int code, Object value, String message) {
        this.code = code;
        this.value = value;
        this.message = message;
    }


    public int getCode() {
        return code;
    }


    public String getMessage() {
        return message;
    }


    public Object getValue() {
        return value;
    }

}
